package com.maven.io.BIO;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.InetAddress;
import java.net.Socket;
import java.net.UnknownHostException;
import java.nio.charset.StandardCharsets;

/**
 * @Author YongQiang
 * @Date 2021/8/17 15:59
 * @Version 1.0
 */
public class Client {
    public static void main(String[] args) throws IOException {
        Socket socket = new Socket(InetAddress.getLocalHost(),8086);
        OutputStream out = socket.getOutputStream();
        out.write("你好".getBytes(StandardCharsets.UTF_8));
        InputStream in = socket.getInputStream();
        byte[] bytes = new byte[in.available()];
        in.read(bytes,0,bytes.length);
        System.out.println(new String(bytes));
        socket.close();


    }
}
